package com.itheima.dao.impl;

import com.itheima.bean.Student;
import com.itheima.dao.StudentMapper;
import com.itheima.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class StudentImpl implements StudentMapper {

    @Override//查找全部学生
    public List<Student> selectAll() {
        SqlSession session = MyBatisUtils.getSession();
        StudentMapper mapper = session.getMapper(StudentMapper.class);
        List<Student> students = mapper.selectAll();
        //关闭会话
        session.close();
        return students;
    }
}
